//
//  AuctionRewardView.swift
//  LeGou
//
//  Created by lxm on 2022/10/17.
//

import UIKit

class AuctionRewardView: XMBaseView {

    //MARK: --------------------属性--------------------
    let disposeBag = DisposeBag()
    //MARK: --------------------UI控件--------------------
    @IBOutlet weak var activityNum: UIButton!
    
    @IBOutlet weak var content: UIView!
    
    @IBOutlet weak var avatar: UIImageView!
    
    @IBOutlet weak var totalPrice: UIButton!
    
    @IBOutlet weak var name: UILabel!
    
    @IBOutlet weak var allReward: UILabel!
    
    @IBOutlet weak var sureBtn: UIButton!
    
    //MARK: --------------------生命周期--------------------
    override init(frame: CGRect) {
        super.init(frame: frame)
        setUI()
        bindAction()
        addConstraints()
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        setUI()
        bindAction()
        addConstraints()
    }

    override func layoutSubviews() {
        super.layoutSubviews()
        content.style.GradientLeftToRight(Top: "#FFEBBE".zm.hex(), Bottom: "#ffffff".zm.hex())
        activityNum.style.GradientLeftToRight(Top: "#F8D490".zm.hex(), Bottom: "#FBE7AF".zm.hex())
    }
    
    //MARK: --------------------UI--------------------
    func setUI() {
        close666TouchOutSideRemove = true
        let tan = DetailShareView.TriangleView()
        tan.direction = .up
        tan.fillColor = UIColor.zm.color(hexString: "#F9D591", 0.65)
        addSubview(tan)
        tan.snp.makeConstraints { make in
            make.centerX.equalTo(activityNum)
            make.bottom.equalTo(activityNum.snp.top)
            make.width.equalTo(5)
            make.height.equalTo(3.5)
        }
    }
    
    func addConstraints() {
     
    }
    
    //MARK: --------------------methods--------------------
    func bindAction() {
        
    }
    
    @IBAction func onClose(_ sender: Any) {
        removeFromSuperview()
    }
    
    //MARK: --------------------delegate--------------------

}


class DashView : UIView {
    override func draw(_ rect: CGRect) {
        super.draw(rect)
        let line = UIBezierPath()
        line.move(to: CGPoint(x: 0, y: rect.size.height - 1))
        line.addLine(to: CGPoint(x: rect.size.width, y: rect.size.height - 1))
        var v : [CGFloat] = [6,6]
        line.setLineDash(&v, count: 2, phase: 2)
        line.lineWidth = 1
        Style.lineColor.setStroke()
        line.stroke()
    }
}
